/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main.controller.actions.observer;

import main.Main;

import javax.swing.*;

/**
 * @author danecek
 */
public abstract class AbstractObserverAction extends AbstractAction {

    public AbstractObserverAction(String name) {
        super(name);
        Main.getInstance().addObserverAction(this);
    }

    public AbstractObserverAction(String name, Icon icon) {
        super(name, icon);
        Main.getInstance().addObserverAction(this);
    }

    public void applicationStateChanged() {
        setEnabled(isEnabledInState());
    }

    abstract boolean isEnabledInState();
}
